package com.shun.common.log;

import com.shun.base.api.ShunBaseApi;
import com.shun.common.log.event.ShunLogListener;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * 自动加载日志配置信息
 * @author lushaonan
 * @since 2020-05-12
 */
@EnableAsync
@AllArgsConstructor
@ConditionalOnWebApplication
@Configuration(proxyBeanMethods = false)
public class LogAutoConfiguration {

	@Autowired
	private final ShunBaseApi baseClient;
	
	@Bean
	public ShunLogListener logListener() {
		return new ShunLogListener(baseClient);
	}
}
